﻿#ifndef SENDAUDIOMSG_H
#define SENDAUDIOMSG_H

#include <QObject>
#include <QAudioInput>

#include "NetHeader.h"

class SendAudioMsg : public QObject
{
    Q_OBJECT
public:
    explicit SendAudioMsg(QObject *parent = nullptr);
    ~SendAudioMsg();

public slots:
    void onStartCollect();

    void onStopCollect();

    void setVolumn(int volumn);

signals:
    void audioInputError(QString);

private:
    QAudioInput     *m_audioInput;
    QIODevice       *m_inputDevice;
    char            *m_recvBuff;

private slots:
    void onReadyRead();

    void handleStateChanged(QAudio::State);

    QString errorString();

};

#endif // SENDAUDIOMSG_H
